package com.googlecode.jtoy.patterns.facade;

import java.util.HashMap;
import java.util.Map;

class KeysDrawer {

	private boolean open = false;

	private Map<String, Integer> keys;

	public KeysDrawer() {

		this.keys = new HashMap<String, Integer>();
		this.keys.put("filesDrawer", 123456);
	}

	/** (getter for open) */
	public boolean isOpen() {

		System.out.println("keys drawer is " + (open ? "open" : "close"));
		return open;
	}

	public void open() {

		this.open = true;
		System.out.println("open keys drawer.");
	}

	public Integer getKey(String which) {

		if (open) {
			System.out.println("get key of files drawer...");
			return keys.get(which);
		}
		return null;
	}

	public void putKey(Integer key) {

		if (open) {
			System.out.println("put key of files drawer.");
		}
	}

	public void close() {

		this.open = false;
		System.out.println("close keys drawer.");
	}
}
